import request from '@/utils/request'

export function getList(params) {
  return new Promise(resolve => {
    resolve(request({
      url: '/product/list',
      method: 'get',
      params
    }))
  })
}

export function deleteProduct(ids) {
  return new Promise(resolve => {
    resolve(request({
      url: '/product/deleteProduct',
      method: 'post',
      data: ids
    }))
  })
}

export function addOrUpdate(data) {
  return new Promise(resolve => {
    resolve(request({
      url: '/product/addOrUpdate',
      method: 'post',
      data
    }))
  })
}

export function uploadPicture(data) {
  return new Promise(resolve => {
    resolve(request({
      url: '/product/upload',
      method: 'post',
      data
    }))
  })
}

export function getDetail(id) {
    return new Promise(resolve => {
        resolve(request({
            url: '/product/getDetail',
            method: 'get',
            params: {
                'id': id
            }
        }))
    })
}
